TOOL.Category		= "Advanced Copy Gun"
TOOL.Name			= "Selector"
TOOL.Command		= nil
TOOL.ConfigName		= nil

function TOOL:LeftClick ( Trace )
	if Trace.HitWorld then return false end
	if CLIENT then return true end
	if CG.EntitiesTemp[self:GetOwner():UniqueID()][Trace.Entity] ~= nil then return false end

	
	local self_ent = Trace.Entity:EntIndex()
	local self_id = self:GetOwner():UniqueID()
	CG.Entities[self_id][self_ent] = {}
	CG.Entities[self_id][self_ent]["Position"] = {}
	CG.Entities[self_id][self_ent]["Position"]["X"] = Trace.Entity:GetPos().x
	CG.Entities[self_id][self_ent]["Position"]["Y"] = Trace.Entity:GetPos().y
	CG.Entities[self_id][self_ent]["Position"]["Z"] = Trace.Entity:GetPos().z
	local Red, Green, Blue, Alpha = Trace.Entity:GetColor()
	CG.Entities[self_id][self_ent]["Color"] = {}
	CG.Entities[self_id][self_ent]["Color"]["Red"] = Red
	CG.Entities[self_id][self_ent]["Color"]["Green"] = Green
	CG.Entities[self_id][self_ent]["Color"]["Blue"] = Blue
	CG.Entities[self_id][self_ent]["Color"]["Alpha"] = Alpha
	CG.Entities[self_id][self_ent]["Angles"] = {}
	CG.Entities[self_id][self_ent]["Angles"]["X"] = string.Explode(" ", Trace.Entity:GetAngles():__tostring())[1]
	CG.Entities[self_id][self_ent]["Angles"]["Y"] = string.Explode(" ", Trace.Entity:GetAngles():__tostring())[2]
	CG.Entities[self_id][self_ent]["Angles"]["Z"] = string.Explode(" ", Trace.Entity:GetAngles():__tostring())[3]
	CG.Entities[self_id][self_ent]["Table"] = {}
	for k, v in pairs(Trace.Entity:GetTable()) do
		CG.Entities[self_id][self_ent]["Table"][k] = v
	end
	CG.Entities[self_id][self_ent]["Model"] = Trace.Entity:GetModel()
	CG.Entities[self_id][self_ent]["MoveType"] = Trace.Entity:GetMoveType()
	CG.Entities[self_id][self_ent]["MoveCollide"] = Trace.Entity:GetMoveCollide()
	CG.Entities[self_id][self_ent]["Parent"] = Trace.Entity:GetParent():EntIndex()
	CG.Entities[self_id][self_ent]["MaxHealth"] = Trace.Entity:GetMaxHealth()
	CG.Entities[self_id][self_ent]["Health"] = Trace.Entity:Health()
	CG.Entities[self_id][self_ent]["Material"] = Trace.Entity:GetMaterial()
	CG.Entities[self_id][self_ent]["Class"] = Trace.Entity:GetClass()
	CG.Entities[self_id][self_ent]["Skin"] = Trace.Entity:GetSkin()
	CG.Entities[self_id][self_ent]["Index"] = Trace.Entity:EntIndex()
	CG.Entities[self_id][self_ent]["Name"] = Trace.Entity:GetName()
	
	table.insert(CG.EntitiesTemp[self_id], Trace.Entity)
	
	Trace.Entity:SetColor(255, 0, 0, 255)
	
	return true
end

function TOOL:RightClick ( Trace )
	for k, v in pairs(CG.EntitiesTemp[self:GetOwner():UniqueID()]) do
		v:SetColor(255, 255, 255, 255)
	end
	CG.EntitiesTemp[self:GetOwner():UniqueID()] = {}
end
